package top.naccl.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @description:自由映射
 * @package top.naccl.config
 * @who MiaoMiao "Sprout" BI
 * @date 2021-01-29 12:24:00
 */
@Configuration
public class MyWebAppConfigurer implements WebMvcConfigurer {

//    ${upload.path}
//    @Value("$spring.resources.static-locations")
//    private String locationPath;


    @Value("${upload.path}")
    public String path;



    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {


//        registry.addResourceHandler("/upload/**").addResourceLocations("file:D:/source/NBlog/blog-api/upload/");
                registry.addResourceHandler("/upload/**").addResourceLocations("file:"+path);
    }
}